/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, #f0f2ff 0%, #e2e6ff 50%, #d8e1ff 100%);
    color: #1d1d1f;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* 背景动态效果 */
body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.3) 2%, transparent 6%),
        radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.3) 2%, transparent 6%),
        radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.3) 1%, transparent 5%),
        radial-gradient(circle at 15% 85%, rgba(255, 255, 255, 0.3) 1%, transparent 5%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.2) 2%, transparent 8%);
    background-size: 150% 150%;
    animation: moveBackground 30s ease infinite;
    z-index: -1;
}

@keyframes moveBackground {
    0%, 100% {
        background-position: 0% 0%;
    }
    25% {
        background-position: 100% 0%;
    }
    50% {
        background-position: 100% 100%;
    }
    75% {
        background-position: 0% 100%;
    }
}

.container {
    width: 100%;
    max-width: 1200px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* 装饰元素 */
.container::before, .container::after {
    content: "";
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.08), rgba(255, 45, 85, 0.08));
    z-index: -1;
}

.container::before {
    top: -150px;
    left: -150px;
    animation: float 15s ease-in-out infinite;
}

.container::after {
    bottom: -150px;
    right: -150px;
    animation: float 20s ease-in-out infinite reverse;
}

/* 头部样式 */
header {
    margin-bottom: 2rem;
    position: relative;
    transition: all 0.5s ease;
}

h1 {
    font-size: 3.2rem;
    font-weight: 700;
    background: linear-gradient(90deg, #007aff, #5e5ce6, #ff2d55);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 1rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    display: inline-block;
    transition: all 0.5s ease;
}

h1::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, #007aff, #ff2d55);
    border-radius: 3px;
    transition: all 0.5s ease;
}

/* 主要内容区 */
main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    position: relative;
    padding-bottom: 30px;
}

/* 按钮容器 */
.button-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 1rem 0 2rem 0;
    z-index: 20;
}

.animation-area {
    width: 100%;
    height: 50vh; /* 调小高度 */
    position: relative;
    perspective: 1200px;
    overflow: hidden;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.2) 0%, transparent 80%);
    border-radius: 20px;
    margin-bottom: 40px;
}

/* 名字动画样式 */
.name-animation {
    position: absolute;
    font-size: 2rem;
    font-weight: 500;
    color: #007aff;
    text-shadow: 0 0 10px rgba(0, 122, 255, 0.5);
    opacity: 0;
    transform: scale(0.5) rotateX(20deg);
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    z-index: 5;
    background: rgba(255, 255, 255, 0.4);
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1),
                inset 0 0 10px rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: glow 2s ease-in-out infinite alternate;
    letter-spacing: 1px;
}

@keyframes glow {
    0% {
        box-shadow: 0 4px 20px rgba(0, 122, 255, 0.1),
                    inset 0 0 10px rgba(255, 255, 255, 0.5);
    }
    100% {
        box-shadow: 0 4px 30px rgba(0, 122, 255, 0.3),
                    inset 0 0 15px rgba(255, 255, 255, 0.7);
    }
}

/* 结果容器 */
.result-container {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    z-index: 30; /* 提高z-index确保在最上层 */
}

/* 结果样式优化 */
.result {
    font-size: 4.5rem;
    font-weight: 700;
    color: #007aff;
    margin-bottom: 1rem;
    padding: 0.5rem 2rem;
    position: relative;
    z-index: 35;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.8);
    letter-spacing: 2px;
}

/* 移除可能导致模糊的伪元素效果 */
.result::before {
    display: none;
}

.result::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 110%;
    height: 110%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    z-index: -1;
    box-shadow: 0 0 30px rgba(0, 150, 255, 0.3);
}

.meme-text {
    font-size: 1.8rem;
    color: #1d1d1f;
    margin-top: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease 0.2s;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 0.8rem 2rem;
    border-radius: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.3);
    max-width: 80%;
    font-weight: 500;
    letter-spacing: 1px;
}

/* 按钮样式 */
.roll-btn {
    background: linear-gradient(145deg, #007aff, #0055b5);
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    padding: 1rem 3rem;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.4);
    transition: all 0.3s ease;
    margin-top: 0;
    z-index: 20;
    position: relative;
    overflow: hidden;
    letter-spacing: 1px;
}

/* 停止按钮样式 */
.roll-btn.stop-btn {
    background: linear-gradient(145deg, #ff2d55, #c1002e);
    box-shadow: 0 4px 20px rgba(255, 45, 85, 0.4);
}

.roll-btn.stop-btn:hover {
    background: linear-gradient(145deg, #ff3b61, #d1103e);
    box-shadow: 0 8px 25px rgba(255, 45, 85, 0.5);
}

.roll-btn.stop-btn:active {
    box-shadow: 0 2px 10px rgba(255, 45, 85, 0.3);
}

.roll-btn::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        rgba(255, 255, 255, 0) 0%, 
        rgba(255, 255, 255, 0.1) 50%, 
        rgba(255, 255, 255, 0) 100%);
    transform: rotate(45deg);
    animation: buttonShine 3s infinite linear;
    z-index: 1;
}

.roll-btn span {
    position: relative;
    z-index: 2;
}

@keyframes buttonShine {
    0% {
        left: -150%;
    }
    100% {
        left: 150%;
    }
}

.roll-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 25px rgba(0, 122, 255, 0.5);
    background: linear-gradient(145deg, #0084ff, #0062cc);
}

.roll-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 10px rgba(0, 122, 255, 0.3);
}

.roll-btn:disabled {
    background: #b3b3b3;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.roll-btn:disabled::before {
    display: none;
}

/* 文件输入框样式 */
.file-input-container {
    margin: 1rem auto;
    width: 100%;
    max-width: 300px;
    position: relative;
    transition: all 0.5s ease;
}

#file-input {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

.file-label {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #007aff, #5e5ce6);
    display: inline-block;
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 122, 255, 0.3);
    text-align: center;
    position: relative;
    overflow: hidden;
    letter-spacing: 1px;
}

.file-label::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        rgba(255, 255, 255, 0) 0%, 
        rgba(255, 255, 255, 0.1) 50%, 
        rgba(255, 255, 255, 0) 100%);
    transform: rotate(45deg);
    animation: buttonShine 3s infinite linear;
    z-index: 1;
}

.file-label:hover {
    background: linear-gradient(135deg, #0084ff, #6b6aff);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.4);
}

.file-label:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

/* 当文件输入隐藏后，调整h1样式 */
.file-input-container[style*="display: none"] + h1,
h1:only-child {
    margin-bottom: 0.5rem;
    font-size: 3.5rem;
}

/* 底部样式 */
footer {
    margin-top: 2rem;
    font-size: 0.9rem;
    color: #86868b;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* 动画效果 */
@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.2) translateY(50px);
    }
    70% {
        opacity: 1;
        transform: scale(1.1) translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes fadeOutScale {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.5);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-20px) scale(1.05);
    }
}

/* 恢复shine动画 */
@keyframes shine {
    to {
        background-position: 200% center;
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .result {
        font-size: 3rem;
    }
    
    .meme-text {
        font-size: 1.2rem;
    }
    
    .roll-btn {
        font-size: 1.2rem;
        padding: 0.8rem 2rem;
    }
}

/* 过渡名字动画样式 */
.transition-name {
    font-size: 3rem !important;
    padding: 1rem 2rem !important;
    z-index: 15 !important;
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    color: #007aff !important;
    text-shadow: none !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
    letter-spacing: 2px !important;
    border-radius: 25px !important;
    font-weight: 600 !important;
}

.final-name {
    font-size: 3.5rem !important;
    font-weight: 700 !important;
    background: rgba(255, 255, 255, 0.7) !important;
    color: #0062cc !important;
    text-shadow: none !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
    border: 2px solid rgba(255, 255, 255, 0.5) !important;
    letter-spacing: 3px !important;
}